package com.itheima.mapper;

import com.itheima.bean.Student;
import com.itheima.sql.ReturnSql;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentMapper {

    //@Select("select * from student")
    @SelectProvider(type = ReturnSql.class,method = "getAll")
    List<Student> findAll();

    //@Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    //@Insert("insert into student values(#{id},#{name},#{age})")
    @InsertProvider(type = ReturnSql.class,method = "getInsert")
    int insert(Student stu);

    //@Update("update student set name=#{name},age=#{age} where id=#{id}")
    @UpdateProvider(type = ReturnSql.class,method = "getUpdate")
    int update(Student stu);

    //@Delete("delete from student where id=#{id}")
    @DeleteProvider(type = ReturnSql.class,method = "getDelete")
    int delete(Integer id);
}
